@import './variables.scss';
@import './_handle.scss';
@import './themes.scss';

#app {
  .main-container {
    min-height: 100%;
    transition: margin-left .28s;
    padding-left: $sideBarWidth;
    width: 100%;
    position: relative;
    background-color: #F2F3F5;
  }

  .sidebar-container {
    transition: width 0.28s;
    width: $sideBarWidth !important;
    background-color: #ffffff;
    height: 100%;
    position: fixed;
    font-size: 0px;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1001;
    box-sizing: border-box;
    padding: 0 16px 18px 16px;
    // background: linear-gradient(180deg, #0969DB 0%, #009EFF 100%);
    @include background_color('colorTheme', 1);
    // overflow: hidden;

    // reset element-ui css
    .horizontal-collapse-transition {
      transition: 0s width ease-in-out, 0s padding-left ease-in-out, 0s padding-right ease-in-out;
    }

    .scrollbar-wrapper {
      // overflow-x: hidden !important;
    }

    .el-scrollbar__bar.is-vertical {
      right: 0px;
    }

    .el-scrollbar {
      // width: 192px;
      height: 100%;
      // background-color: #ffffff !important;
    }

    &.has-logo {
      .el-scrollbar {
        height: calc(100% - 50px);
      }
    }

    .is-horizontal {
      display: none;
    }

    a {
      display: inline-block;
      width: 100%;
      overflow: hidden;
    }

    .svg-icon {
      margin-right: 16px;
    }

    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }

    .el-menu {
      border: none;
      height: 100%;
    }

    // menu hover
    // .submenu-title-noDropdown,
    // .el-submenu__title {

    //   &:hover {
    //     background-color: transparent !important;
    //   }

    //   // i {
    //   //   margin: 0 3px 0 4px !important;
    //   // }
    // }
    .middle-menu-wrapper.is-active> .el-submenu__title {
      .el-menu-item.menu-grade2{
        >div{
          @include background_color('colorTheme', 1);
        }
        >span{
          // color: #ffffff !important;
          @include font_color('colorTheme');
        }
      }
    }

    & .nest-menu .middle-menu-wrapper>.el-submenu__title{
      .el-menu-icon-right{
        transform: rotate(90deg) !important;
      }
    }
    & .el-submenu>.el-menu-item {
      min-width: $sideBarWidth !important;
      // background-color: $subMenuBg !important;

      &:hover {
        background-color: $subMenuHover !important;
      }
    }
    // 二级菜单
    & .nest-menu .middle-menu-wrapper.el-submenu.is-active.is-opened{
      .middle-menu-hover{
        .el-menu-icon-right{
          @include font_color('colorTheme');
        }
      }
    }
    & .nest-menu .middle-menu-wrapper.el-submenu{
      > .el-submenu__title{
        box-sizing: border-box;
        // padding: 7px 8px !important;
        padding: 0 !important;
        .second-menu-bg{
          position: relative;
          display: flex; 
          align-items: center; 
          width: 100%; 
          height: 46px;
          padding-left: 29px;
          padding-right: 12px;
          // &:hover{
          //   @include background_color('colorFFF', 1);
          //   @include font_color('colorTheme');
          //   border-radius: 4px;
          // }
        }
        a {
          span{
            margin-left: 0 !important;
          }
        }
        .middle-menu-hover{
          .el-menu-icon-right{
            // color: rgba(0, 0, 0, 0.25) !important;
            @include font_color('colorFFF');
          }
          border-radius: 4px;
          &:hover{
            a {
              span{
                color: #ffffff !important;
              }
            }
            @include background_color('colorFFF', 1);
            @include font_color('colorTheme');
            .el-menu-icon-right{
              @include font_color('colorTheme');
            }
          }
        }
        .backgroundTheme{
          a {
            span{
              color: #ffffff !important;
            }
          }
          color: #ffffff !important;
          .el-menu-icon-right{
            color: #ffffff !important;
          }
        }
      }

    }

    & .middle-menu-wrapper.el-submenu.is-active{
      > .el-submenu__title{
        >div{
          // @include background_color('colorTheme', 1);
          background-color: #ffffff;
          border-radius: 4px;
          @include font_color('colorTheme');
          .el-menu-icon-right{
            @include font_color('colorTheme');
          }
        }
      }
    }
    
    .middle-menu{
      .el-submenu{
        display: none;
      }
    }
  }

  .hideSidebar {
    .sidebar-container {
      width: 54px !important;
    }

    .main-container {
      margin-left: 54px;
    }

    .submenu-title-noDropdown {
      padding: 0 !important;
      position: relative;

      .el-tooltip {
        padding: 0 !important;

        .svg-icon {
          margin-left: 20px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }
      }
    }

    .el-submenu {
      // overflow: hidden;

      &>.el-submenu__title {
        padding: 0 !important;

        .svg-icon {
          margin-left: 20px;
        }

        .sub-el-icon {
          margin-left: 19px;
        }

      }
    }

    .el-menu--collapse {
      .el-submenu {
        &>.el-submenu__title {
          &>span {
            height: 0;
            width: 0;
            // overflow: hidden;
            visibility: hidden;
            display: inline-block;
          }
        }
      }
    }
  }

  // mobile responsive
  .mobile {
    .main-container {
      margin-left: 0px;
    }

    .sidebar-container {
      transition: transform .28s;
      width: $sideBarWidth !important;
    }

    &.hideSidebar {
      .sidebar-container {
        pointer-events: none;
        transition-duration: 0.3s;
        transform: translate3d(-$sideBarWidth, 0, 0);
      }
    }
  }

  .withoutAnimation {

    .main-container,
    .sidebar-container {
      transition: none;
    }
  }
}

// when menu collapsed
.el-menu--vertical {
  &>.el-menu {
    .svg-icon {
      margin-right: 16px;
    }

    .sub-el-icon {
      margin-right: 12px;
      margin-left: -2px;
    }
  }


  // the scroll bar appears when the subMenu is too long
  >.el-menu--popup {
    max-height: 100vh;
    overflow-y: auto;

    &::-webkit-scrollbar-track-piece {
      background: #d3dce6;
    }

    &::-webkit-scrollbar {
      width: 6px;
    }

    &::-webkit-scrollbar-thumb {
      background: #99a9bf;
      border-radius: 20px;
    }
  }
}

.el-menu-item {
  padding: 0 !important;
}

.next-menu-title {
  font-size: 16px !important;
  color: #333333 !important;
  font-weight: 400 !important;
  line-height: 48px !important;
  text-align: center !important;
}

.el-menu--inline {
  // position: fixed !important;
  // left: 80px !important;
  // top: 50px !important;
  // bottom: 0 !important;
  // width: 120px !important;
  // background-color: #ffffff !important;
  // overflow-y: auto;
  // height: calc(100vh - 50px) !important;

  &::-webkit-scrollbar {
    width: 4px;
  }

  &::-webkit-scrollbar-thumb {
    border-radius: 10px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, .2);
    background: rgba(0, 0, 0, 0.2);
  }

  &::-webkit-scrollbar-track {
    box-shadow: inset 0 0 5px rgba(0, 0, 0, .2);
    border-radius: 0;
    background: rgba(0, 0, 0, .1);
  }
  .nest-menu {
    position: relative;
    margin-bottom: 8px !important;
    .el-menu-item {
      background-color: transparent !important;
      // width: 120px !important;
      min-width: 120px !important;
      text-align: left !important;
      color: #666666 !important;
      >span {
        padding: 16px !important;
        font-size: 12px !important;
      }
    }
    .el-menu-item.menu-grade2{
      >span{
        font-size: 14px !important;
        font-weight: 400 !important;
        padding: 0 8px !important;
        @include font_color('colorFFF');
      }
    }
    .second-menu-bg:hover{
      @include background_color('colorFFF', 1);
      border-radius: 4px;
      .el-menu-item.menu-grade2{
        >span{
          @include font_color('colorTheme');
        }
      }
    }
  }
}

.el-submenu .el-menu-item{
  height: 46px !important;
  line-height: 46px !important;
}
.el-submenu__icon-arrow {
  display: none;
  font-size: 0 !important;
}

.el-submenu {
  .el-menu-icon-right{
    transform: rotate(-180deg);
  }
}
.el-submenu.is-opened {
  .el-submenu__title{
    // @include background_color('colorTheme', .05);
    background-color: rgba(255, 255, 255, 0.08);
  }
  .el-menu-icon-right{
    transition: .5s;
    transform: rotate(0);
  }
}
.scrollBar-z-wrapper{
  overflow-y: auto !important; 
  // overflow-x: clip !important;
  // margin-right: 0 !important;
  > .el-scrollbar__view > .menu-wrapper.el-menu > div{
    .middle-menu-wrapper.el-submenu > .el-submenu__title::after{
      border: none !important;
    }
  } 
}
.el-scrollbar__wrap{
  overflow: auto !important;
}
.menu-wrapper.el-menu > div{
  >.el-submenu{
    >.el-submenu__title{
      padding: 0 12px !important;
    }
  }
  .el-submenu__title{
    &:hover{
      // background-color: rgba(255, 255, 255, 0.08);
      @include background_color('colorTheme', .05);
    }
  }
  >.el-submenu.is-opened{
    // @include background_color('colorTheme', .05);
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    .el-submenu__title{
      >div{
        >i.iconfont{
          // @include font_color('colorTheme');
          color: #ffffff;
        }
      }
    }
    .el-submenu__title, 
    .el-menu.el-menu--inline{
      background-color: transparent !important;
    }
    
  }
}
.el-submenu [class^=el-icon-]{
  margin-right: 0 !important;
  width: 16px !important;
}
.el-submenu__title{
  padding-right: 10px !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  height: 46px !important;
  line-height: 46px !important;
  margin-bottom: 4px !important;
  border-radius: 4px !important;
}


.el-menu.menu-wrapper{
  > div {
    i.iconfont{
      // color: #ffffff !important;
    }
    >.el-submenu.is-active.is-opened{
      >.el-menu.el-menu--inline{
        margin-bottom: 8px !important;
      }
    }
  }
  .nest-menu{
    &:last-of-type{
      margin-bottom: 0 !important;
    }
    .el-submenu__title{
      margin-bottom: 0 !important;
    }
  }
}